#include <cstdio>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>



int main()
{
	char ip[] = "baidu.com";
	struct hostent* h;
	if((h=gethostbyname(ip))==0)
	{
		printf("error ip\n");
		return -1;
	}
	printf("right ip\n");
	for(int i=0; h->h_addr_list[i];++i)
	{
		printf("IP addr %d:%s\n",i+1,inet_ntoa(*(struct in_addr*)h->h_addr_list[i]));
	}
	return 0;
}
